#include "showClueCardMessage.h"
#include <rapidjson/document.h>
#include "jsonUtils.h"

ShowClueCardMessage::ShowClueCardMessage(MtpProtocol* packet) : MtpMessage(packet),id(0),channel(0)
{

}

ShowClueCardMessage::ShowClueCardMessage(const int64_t& id, const int& channel) : MtpMessage(new MtpProtocol(L"showClueCard")),id(id),channel(channel)
{

}

void ShowClueCardMessage::decodeBody()
{
	MtpMessage::decodeBody();
	JsonDoc doc(rapidjson::kObjectType);
	doc.Parse(jsonContent.c_str());
	JsonUtils::loadLong(doc, L"id", id);
	JsonUtils::loadInt(doc, L"channel", channel);
}

void ShowClueCardMessage::encodeBody()
{
	JsonDoc doc(rapidjson::kObjectType);
	doc.AddMember(L"id", id, doc.GetAllocator());
	doc.AddMember(L"channel", channel, doc.GetAllocator());
	jsonContent = JsonUtils::jsonStr(doc);
	MtpMessage::encodeBody();
}

const int64_t& ShowClueCardMessage::getId()
{
	return id;
}

const int& ShowClueCardMessage::getChannel()
{
	return channel;
}
